<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let ary = [1, 2, 3, 1, 2, 1, 2, 3, 2, 1, 2, 3]
        let newAry = []
        for (let i = 0; i < ary.length; i++) {
            //循环获取原有数组中的每一项
            var item = ary[i]
            if (newAry.includes(item)) {
                //新数组存在这一项,不在添加到新数组中，继续下一轮循环
                continue
            }
            newAry.push(ary[i])
        }
        //有兼容性问题
    </script>
</body>

</html>